package ph.com.gs3.formalistics.custom.implementation;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.print.PrintJob;
import android.webkit.WebView;

public class SmartmaticPrintingUtility {

	public static WebView currentlyPrintingWebView;
	public static List<PrintJob> printJobList = new ArrayList<>();

	public static void printReceivingCorrectionReport() {

	}

	public static void print(final Context context, final String htmlToPrint, final String jobName) {
//		WebView webView = new WebView(context);
//		webView.setWebViewClient(new WebViewClient() {
//
//			public boolean shouldOverrideUrlLoading(WebView view, String url) {
//				return false;
//			}
//
//			@Override
//			public void onPageFinished(WebView view, String url) {
//				createWebPrintJob(context, view, jobName);
//				currentlyPrintingWebView = null;
//			}
//		});
//
//		webView.loadDataWithBaseURL(null, htmlToPrint, "text/HTML", "UTF-8", null);
//
//		// Keep a reference to WebView object until you pass the
//		// PrintDocumentAdapter
//		// to the PrintManager
//		currentlyPrintingWebView = webView;
	}

	private static void createWebPrintJob(Context context, WebView webView, String jobName) {

//		// Get a PrintManager instance
//		PrintManager printManager = (PrintManager) context.getSystemService(Context.PRINT_SERVICE);
//
//		// Get a print adapter instance
//		PrintDocumentAdapter printAdapter = webView.createPrintDocumentAdapter();
//
//		PrintJob printJob = printManager.print(jobName, printAdapter,
//		        new PrintAttributes.Builder().build());
//
//		// Save the job object for later status checking
//		printJobList.add(printJob);
	}

}
